//	ID : pallab81
// 	PROG : 10651
// 	LANG : C++
// 	2011-09-08-13.43.49 Thursday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define fo(i,ed) foR( i , 0 , ed )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ){
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ){
        ;
    }
}
int dp[ 1<<14 ];
int mask_;
inline int select(int mask, int bit){
    return ( mask| (1<<bit) ) ;
}
inline bool isSelected(int mask, int bit){
    return ( (mask&(1<<bit))!=0 );
}
inline int clearBit(int mask, int bit){
    mask&= ~(1<<bit) ;
    return mask;
}
inline void Read(){
    int mask=0;
    char x;
    fo(i,12){
        cin>>x;
        if( x=='o' ){
            mask = select(mask,i);
        }
    }
    mask_ = mask;
}
inline int go(int mask){

    int& best= dp[mask];
    if( best!=-1 ){
        return best;
    }
    best=0;
    for(int i=0;i<12;++i){
        if( isSelected(mask,i) ){
            if( i-2>=0 && ( isSelected(mask,i-1)==true && isSelected(mask,i-2)==false  ) ){
                int MASK = clearBit(mask,i);
                MASK = clearBit(MASK,i-1);
                MASK = select(MASK,i-2);
                int var1 = 1+go( MASK );
                best = max( best, var1 );
            }
            if( i+2<12 && ( isSelected(mask,i+1)==true && isSelected(mask,i+2)==false ) ){
                int MASK = clearBit(mask,i);
                MASK = clearBit(MASK,i+1);
                MASK = select(MASK,i+2);
                int var2 = 1+go( MASK );
                best = max( best, var2 );
            }
        }
    }
return best;
}
inline void Proc(){
    SET(dp,-1);
    int var = go(mask_);
    int bit_left = __builtin_popcount(mask_)-var;
    cout<<bit_left<<"\n";
}
int main(){
    #ifndef ONLINE_JUDGE
        freopen("in.txt","rt",stdin);
    #endif

    int cases=1;
    for( CI(cases) ; cases ; --cases ){
            Read();
            Proc();
    }

return 0;
}
